//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#ifndef __ELASTOS_TIMER_H__
#define __ELASTOS_TIMER_H__

enum {
    PIT_ClockRate               = 508469,                       // unit: HZ
    PIT_ClockCycle              = (1000000000 / PIT_ClockRate), // unit: NS
};

enum {
    PIT_Irq                     = 9,
};

// Registers' IO address
#define _LOAD1      ((ioport_t)0x80000c00)
#define _VALUE1     ((ioport_t)0x80000c04)
#define _CONTROL1   ((ioport_t)0x80000c08)
#define _TCEOI1     ((ioport_t)0x80000c0c)

#define _LOAD2      ((ioport_t)0x80000c20)
#define _VALUE2     ((ioport_t)0x80000c24)
#define _CONTROL2   ((ioport_t)0x80000c28)
#define _TCEOI2     ((ioport_t)0x80000c2c)

#define _LOAD3      ((ioport_t)0x80000c80)
#define _VALUE3     ((ioport_t)0x80000c84)
#define _CONTROL3   ((ioport_t)0x80000c88)
#define _TCEOI3     ((ioport_t)0x80000c8c)

// Timer Control Registers
#define _CLKSEL __32BIT(3)  // Timer[2:1] Clock Select Selects the clock for
                            // the specified Timer: 1 = 508 kHz, 0 = 2 kHz
#define _MODE   __32BIT(6)  // Timer Mode Selects the Timer operating mode:
                            // 1 = Periodic, 0 = Free Running
#define _ENABLE __32BIT(7)  // Enable Timer:
                            // 1 = Enable the specified Timer
                            // 0 = Disable the specified Timer

#endif // __ELASTOS_TIMER_H__
